﻿using System;
using System.Windows.Input;

namespace BlogApp.WP8.Utils
{
    public class GoBackCommand : ICommand
    {
        public GoBackCommand()
        {
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        //See http://blogs.msdn.com/b/trevor/archive/2008/08/14/c-warning-cs0067-the-event-event-is-never-used.aspx
        public event EventHandler CanExecuteChanged
        {
            add { }
            remove { }
        }

        public void Execute(object nothing)
        {
            var root = App.RootFrame;
            if (root.CanGoBack)
                root.GoBack();
        } 
    }
}